using System;
using Sedge.Core.Configuration;

namespace Sedge.Core.Execution.ReportElements
{
	public abstract class ReportElementBase : IReportElement
	{
		protected readonly Suite Suite;

		public string Header { get; set; }

		protected ReportElementBase(Suite suite)
		{
			Suite = suite;
		}

		public abstract string GetHtml();
		public abstract void MergeWith(IReportElement element);
		
		public virtual bool CanMergeWith(IReportElement element)
		{
			return element != null && GetType() == element.GetType() && Header == element.Header;
		}

		protected string GetHeaderAsHtml()
		{
			return String.IsNullOrEmpty(Header) ? String.Empty : String.Format("<h2>{0}</h2>", Header);
		}
	}
}